<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改工程其他合同')" />
    <th:block th:include="include :: jasny-bootstrap-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
    	<!-- 打印网页时通过hidden-print隐藏元素 -->
	    <div class="text-right hidden-print">
	        <input th:value="${gcProjectOther.id}" type="hidden" id="id" name="id" />
            <button id="button-yes" type="button" class="btn btn-sm btn-primary" ><i class="fa fa-check"></i>审核通过</button>&nbsp;
            <button id="button-no" type="button" class="btn btn-sm btn-danger" ><i class="fa fa-remove"></i>审核拒绝</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
	    </div>
        <form class="form-horizontal m" id="form-other-edit" th:object="${gcProjectOther}">
            <h4 class="form-header h4">基本信息</h4>
            <input name="id" th:field="*{id}" type="hidden">
            <input name="gcProjectid" th:field="*{gcProjectid}" type="hidden">
            <input type="hidden" id="zlwj" name="zlwj" th:value="*{zlwj}" />
            <input type="hidden" id="zhengsht" name="zhengsht" th:value="*{zhengsht}" />
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">合同编号：</label>
                <div class="col-sm-2">
                    <input name="orderNo" th:field="*{orderNo}" readonly="readonly" class="form-control" type="text" required />
                </div>
                <label class="col-sm-2 control-label is-required">合同类型：</label>
                <div class="col-sm-2">
                    <select name="type" th:field="*{type}" readonly="readonly" class="form-control" required th:with="type=${@dict.getType('gcgl_other_type')}">
		                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
		            </select>
                </div>
                <label class="col-sm-1 control-label is-required">项目名称：</label>
                <div class="col-sm-3">
                    <input name="name" th:field="*{name}" readonly="readonly" class="form-control" type="text" required />
                </div>
            </div>
            <div class="form-group">  
            	<label class="col-sm-2 control-label is-required">供应商名称：</label>
                <div class="col-sm-2">
                    <input name="supplyName" th:field="*{supplyName}" readonly="readonly" class="form-control" type="text" required />
                </div> 
                <label class="col-sm-2 control-label is-required">合同总金额：</label>
                <div class="col-sm-2">
                    <input name="zongje" th:field="*{zongje}" readonly="readonly" class="form-control" type="text" required />
                </div>
            </div>
            <div class="form-group"> 
            	<label class="col-sm-2 control-label is-required">合同简要说明：</label>
                <div class="col-sm-10">
                    <textarea name="descs" class="form-control" required readonly="readonly">[[*{descs}]]</textarea>
                </div>   
            </div>
            <div class="form-group">  
                <label class="col-sm-2 control-label">评审合同文件：</label>
                <div class="col-sm-10" style="margin-top: 8px;" id="zlwjlink">
                </div>
            </div>
            <div class="form-group">  
                <label class="col-sm-2 control-label">正式合同文件：</label>
                <div class="col-sm-10" style="margin-top: 8px;" id="zhengshtlink">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">审批意见：</label>
                <div class="col-sm-10">
                	<textarea id="spyj" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <script th:src="@{/ruoyi/base64.min.js?v=20231208}"></script>
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <th:block th:include="include :: bootstrap-suggest-js" />
    <th:block th:include="include :: bootstrap-typeahead-js" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/other";
        $("#form-other-edit").validate({
            focusCleanup: true
        });
        
        $(function() {
        	var zilwj = $("#zlwj").val();
        	var n=zilwj.split(",");
        	for(var i=0;i<n.length;i++){
        		if(n[i]!=""){
//         		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
        		var url = n[i];
        		$("#zlwjlink").append("<a href='"+url+"' target='_blank' >"+n[i]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
        		$("#zlwjlink").append("<a href='"+n[i]+"' target='_blank' >下载</a><br>");
        		}
        	}
        	
			var zhengsht = $("#zhengsht").val();
        	var m=zhengsht.split(",");
        	for(var j=0;j<m.length;j++){
        		if(m[j]!=""){
//         		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(m[j]));
        		var url = m[i];
        		$("#zhengshtlink").append("<a href='"+url+"' target='_blank' >"+m[j]+"</a>&nbsp;&nbsp;&nbsp;&nbsp;");
        		$("#zhengshtlink").append("<a href='"+m[j]+"' target='_blank' >下载</a><br>");
        		}
        	}
        });

        function submitHandler() {
            if ($.validate.form()) {
            	
            	var form = document.getElementById("form-other-edit");
                var file = new FormData(form);
                $.ajax({
                    url: "/gcgl/other/edit",
                    type: "POST",
                    processData:false,
                    contentType:false,
                    //重要部分，data的传的是整个表单，不用大括号包裹；不用自定义变量名
                    data:file,
                    success: function (data) {
                    	$.operate.saveReload(data);
                    },
                    error: function (data) {
                    	$.operate.saveReload(data);
                    }
                })
            	
                //$.operate.save(prefix + "/edit", $('#form-other-edit').serialize());
            }
        }

        $("#button-yes").click(function(){
	    	$.modal.confirm("确认要审核通过吗?", function() {
	    		$.ajax({
    				url: "/gcgl/other/yes",
    				type: "post",
    				data: { "ids": $("#id").val(),"spyj": $("#spyj").val() },
    				dataType: 'json',
    				success: function(data) {
    					$.operate.saveReload(data);
    				},
    				error: function(xhr, type, errorThrown) {
    					//异常处理；
    					$.modal.alert("请稍后再试！");
    					$.operate.saveReload(data);
    				}
    			});
	    	});
	    })
	    
	    $("#button-no").click(function(){
	    	$.modal.confirm("确认要审核拒绝吗?", function() {
	    		$.ajax({
    				url: "/gcgl/other/no",
    				type: "post",
    				data: { "ids": $("#id").val(),"spyj": $("#spyj").val() },
    				dataType: 'json',
    				success: function(data) {
    					$.operate.saveReload(data);
    				},
    				error: function(xhr, type, errorThrown) {
    					//异常处理；
    					$.modal.alert("请稍后再试！");
    					$.operate.saveReload(data);
    				}
    			});
	    	});
	    })
    </script>
</body>
</html>